local shiyanj = fk.CreateSkill {
  name = "shiyanj",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["shiyanj"] = "世言甲",
  [":shiyanj"] = "锁定技，你造成或受到一点伤害后，你与伤害来源各失去2点体力，然后你随机失去0-600点体力上限。",
}

-- 造成伤害后
shiyanj:addEffect(fk.Damage, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(shiyanj.name)
  end,
  trigger_times = function(self, event, target, player, data)
    return data.damage
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player, 2, shiyanj.name)
    if data.from then
      room:loseHp(data.from, 2, shiyanj.name)
    end
    room:changeMaxHp(player, -math.random(0,600))
  end
})

-- 受到伤害后
shiyanj:addEffect(fk.Damaged, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(shiyanj.name)
  end,
  trigger_times = function(self, event, target, player, data)
    return data.damage
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:loseHp(player, 2, shiyanj.name)
    if data.from then
      room:loseHp(data.from, 2, shiyanj.name)
    end
    room:changeMaxHp(player, -math.random(0,600))
  end
})


return shiyanj
